﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.ComplexEventProcessing;
using Microsoft.ComplexEventProcessing.Adapters;

namespace Microsoft.Samples.SmartGrid.AMI.ServiceBrokerOutputAdapter
{
    public class ServiceBrokerOutputAdapterFactory: IOutputAdapterFactory<ServiceBrokerOutputAdapterConfig>
    {

        public OutputAdapterBase Create(ServiceBrokerOutputAdapterConfig configInfo, EventShape eventShape, CepEventType cepEventType)
        {
            OutputAdapterBase ret = default(OutputAdapterBase);

            switch (eventShape)
            {
                case EventShape.Point:
                    ret = new ServiceBrokerOutputPointAdapter(configInfo, cepEventType);
                    break;
                default:
                    throw new ApplicationException("This adapter type is not supported.");
            }

            return ret;
        }

        public void Dispose()
        {
        }
    }
}
